package com.hd123.rumba.gwt.widget.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Label;

public class InfoLabel extends Label {
  private int contentType;
  
  public static final int HINT = 0;
  public static final int SUCCESS = 1;
  public static final int FAIL = 2;
  public static final int PROGRESS = 3;

  public void setHintText(String text) {
    setStyleName("jdgwt-label-hint");
    setText(text);
    setVisible(true);
    contentType = HINT;
  }

  public void setSuccessText(String text) {
    setStyleName("jdgwt-label-success");
    setText(text);
    setVisible(true);
    contentType = SUCCESS;
  }

  public void setFailText(String text) {
    setStyleName("jdgwt-label-fail");
    setText(text);
    setVisible(true);
    contentType = FAIL;
  }

  public void setProgressText(String text) {
    setStyleName("jdgwt-label-progress");
    setText(text);
    setVisible(true);
    contentType = PROGRESS;
  }
  
  public int getContentType() {
    return contentType;
  }

  public void setFailHtml(String message) {
    DOM.setInnerHTML(getElement(), message);
    contentType = FAIL;
  }
}
